﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Shared/OneColumn.Master" AutoEventWireup="true"
    CodeBehind="Group.aspx.cs" Inherits="SharingCenter.Web.Mod.Groups.CreateGroup" ValidateRequest="false" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitlePlaceHolder" runat="server">
    组建圈子
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContentPlaceHolder" runat="server">
    <asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server">
        <Scripts>
            <asp:ScriptReference Path="~/Mod/Groups/CreateGroup.js" />
        </Scripts>
    </asp:ScriptManagerProxy>
       
        <div class="formtable">
            <asp:FormView ID="FormView1" runat="server"  Width="100%" 
                CellPadding="0" DataKeyNames="GroupId" DataSourceID="LinqDataSource1">
                <EditItemTemplate>
                     <myuc:GenericTabs ID="LinkListTabs1" runat="server" Section="Groups" SelectedItem="edit" />
                    <h2><myuc:IconSet ID="IconSet1" runat="server" Text="编辑圈子信息" CssClass="ns-edit" /></h2>
                    <div class="formtable">
                        <table>
                            <tr>
                                <td>
                                    圈子类型:
                                </td>
                                <td>
                                    <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="xmlCategory" 
                                        DataTextField="name" DataValueField="name" 
                                        SelectedValue='<%# Bind("GroupCategory") %>' Width="200px">
                                    </asp:DropDownList>
                                    <asp:XmlDataSource ID="xmlCategory" runat="server" 
                                        DataFile="~/App_Data/GroupCategories.xml"></asp:XmlDataSource>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    圈子名字:
                                </td>
                                <td>
                                    <asp:TextBox  Width="300" ID="TextBox1" runat="server" Text='<%# Bind("GroupName") %>'></asp:TextBox>
                                    <%--<div class="nss ns-tick goodname" style="display:none;"></div>--%>
                                    <asp:RequiredFieldValidator ValidationGroup="create" ID="RequiredFieldValidator1" ControlToValidate="TextBox1" Display="None" runat="server" ErrorMessage="圈子名称不能为空。"></asp:RequiredFieldValidator>
                                    <cc:CustomValidatorCallOut ID="CustomValidatorCallOut1" runat="server" TargetControlID="RequiredFieldValidator1">
                                    </cc:CustomValidatorCallOut>
                                    <asp:CustomValidator ID="CustomValidator1" ClientValidationFunction="OtherGroupExists" ValidateEmptyText="false" runat="server" ErrorMessage="已经有相同名称的圈子。" ValidationGroup="create" ControlToValidate="TextBox1" Display="None"></asp:CustomValidator>
                                    <cc:CustomValidatorCallOut ID="CustomValidatorCallOut2" runat="server" TargetControlID="CustomValidator1" PopupPosition="Right">
                                    </cc:CustomValidatorCallOut>
                                </td>
                            </tr>
                            <tr>
                                <td valign="top">
                                    所在地区:</td>
                                <td>
                                    <myuc:ProvinceCityDropDownList runat="server" ID="ProvinceCity" SelectedCity='<%#Bind("City") %>'
                                     SelectedProvince='<%#Bind("Province") %>' />
                                    </td>
                            </tr>
                            <tr>
                                <td>
                                    公开程度:</td>
                                <td>
                                    <asp:DropDownList ID="DropDownList2" runat="server" DataSourceID="xmlPrivacy" 
                                        DataTextField="Text" DataValueField="Value" Width="200px" 
                                        SelectedValue='<%# Bind("Privacy") %>'>
                                    </asp:DropDownList>
                                    <asp:XmlDataSource ID="xmlPrivacy" runat="server" 
                                        DataFile="~/App_Data/GroupPrivacy.xml"></asp:XmlDataSource>
                                </td>
                            </tr>
                            <tr>
                                <td valign="top">
                                    加入圈子须知:</td>
                                <td>
                                    <asp:TextBox runat="server" Width="300" ID="PrefaceTextBox" TextMode="MultiLine" Rows="3" Text='<%#Bind("Preface") %>' />
                                </td>
                            </tr>
                            <tr>
                                <td valign="top">
                                    圈子介绍:</td>
                                <td>
                                    <myuc:Editor ID="Editor1" runat="server" Width="300" Height="100" EditorType="Simple" Content='<%#Bind("Description") %>' />
                                    
                                </td>
                            </tr>
                            
                        </table>
                        <div class="actionarea textfar">
                            <asp:LinkButton ID="LinkButton1" runat="server" CssClass="submitbutton" ValidationGroup="create" CommandName="Update">确定</asp:LinkButton>
                        </div>
                    </div>
                </EditItemTemplate>
                <InsertItemTemplate>
                     <myuc:GenericTabs ID="LinkListTabs2" runat="server" Section="Groups" SelectedItem="1" />
                    <h2 class="bb"><myuc:IconSet ID="IconSet2" runat="server" Text="组建圈子" CssClass="ns-add" /></h2>
                    <div class="formtable">
                        <table>
                            <tr>
                                <td>
                                    圈子类型:
                                </td>
                                <td>
                                    <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="xmlCategory" 
                                        DataTextField="name" DataValueField="name" 
                                        SelectedValue='<%# Bind("GroupCategory") %>' Width="200px">
                                    </asp:DropDownList>
                                    <asp:XmlDataSource ID="xmlCategory" runat="server" 
                                        DataFile="~/App_Data/GroupCategories.xml"></asp:XmlDataSource>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    圈子名字:
                                </td>
                                <td>
                                    <asp:TextBox  Width="300" ID="TextBox1" runat="server" Text='<%# Bind("GroupName") %>'></asp:TextBox>
                                    <%--<div class="nss ns-tick goodname" style="display:none;"></div>--%>
                                    <asp:RequiredFieldValidator ValidationGroup="create" ID="RequiredFieldValidator1" ControlToValidate="TextBox1" Display="None" runat="server" ErrorMessage="圈子名称不能为空。"></asp:RequiredFieldValidator>
                                    <cc:CustomValidatorCallOut ID="CustomValidatorCallOut1" runat="server" TargetControlID="RequiredFieldValidator1">
                                    </cc:CustomValidatorCallOut>
                                    <asp:CustomValidator ID="CustomValidator1" ClientValidationFunction="GroupExists" ValidateEmptyText="false" runat="server" ErrorMessage="已经有相同名称的圈子。" ValidationGroup="create" ControlToValidate="TextBox1" Display="None"></asp:CustomValidator>
                                    <cc:CustomValidatorCallOut ID="CustomValidatorCallOut2" runat="server" TargetControlID="CustomValidator1" PopupPosition="Right">
                                    </cc:CustomValidatorCallOut>
                                </td>
                            </tr>
                            <tr>
                                <td valign="top">
                                    所在地区:</td>
                                <td>
                                   <myuc:ProvinceCityDropDownList runat="server" ID="ProvinceCity" SelectedCity='<%#Bind("City") %>'
                                     SelectedProvince='<%#Bind("Province") %>' />
                                     </td>
                            </tr>
                            <tr>
                                <td>
                                    公开程度:</td>
                                <td>
                                    <asp:DropDownList ID="DropDownList2" runat="server" DataSourceID="xmlPrivacy" 
                                        DataTextField="Text" DataValueField="Value" Width="200px" 
                                        SelectedValue='<%# Bind("Privacy") %>'>
                                    </asp:DropDownList>
                                    <asp:XmlDataSource ID="xmlPrivacy" runat="server" 
                                        DataFile="~/App_Data/GroupPrivacy.xml"></asp:XmlDataSource>
                                </td>
                            </tr>
                            <tr>
                                <td valign="top">
                                    加入圈子须知:</td>
                                <td>
                                    <asp:TextBox runat="server" Width="300" ID="PrefaceTextBox" TextMode="MultiLine" Rows="3" Text='<%#Bind("Preface") %>' />
                                </td>
                            </tr>
                            <tr>
                                <td valign="top">
                                    圈子介绍:</td>
                                <td>
                                    <myuc:Editor ID="Editor1" runat="server" Width="300" Height="100" EditorType="Simple" Content='<%#Bind("Description") %>' />
                                    
                                </td>
                            </tr>
                            
                        </table>
                        <div class="actionarea textfar">
                            <asp:LinkButton ID="LinkButton1" runat="server" CssClass="submitbutton" ValidationGroup="create" CommandName="Insert">确定</asp:LinkButton>
                        </div>
                    </div>
                </InsertItemTemplate>
            </asp:FormView>
            <asp:LinqDataSource ID="LinqDataSource1" runat="server" 
                ContextTypeName="SharingCenter.Web.Classes.scDataContext" EnableInsert="True" 
                EnableUpdate="True" TableName="Sc_Groups">
                <InsertParameters>
                    <asp:ProfileParameter Name="OwnerUserId" PropertyName="UserId" />
                    <asp:Parameter DefaultValue="true" Name="AdminApproved" />
                    <asp:Parameter DefaultValue="0" Name="MemberCount" />
                    <asp:Parameter DefaultValue="0" Name="GroupScore" />
                    <asp:Parameter Name="CreateDate" />
                </InsertParameters>
                <SelectParameters>
                    <asp:QueryStringParameter Name="GroupId" QueryStringField="id" />
                    <asp:ProfileParameter Name="OwnerUserId" PropertyName="UserId" />
                </SelectParameters>
            </asp:LinqDataSource>
        </div>
</asp:Content>
